package com.tencent.crazypenguin.action;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.tencent.crazypenguin.bean.User;
import com.tencent.crazypenguin.bean.Comment;
import com.tencent.crazypenguin.config.ResultType;
import com.tencent.crazypenguin.dao.CommentDao;
import com.tencent.crazypenguin.dao.UserDao;
import com.tencent.crazypenguin.util.JsonUtil;

import net.sf.json.JSONObject;

public class ChooseUserYN extends ActionSupport {

	private static final long serialVersionUID = -1L;
	private String result;

//	@Override
//	public String execute() throws Exception {
//		String loginUser = null;
//		String partner = null;
//		String flag = null;
//		//int tep;
//		try {
//			UserDao userDao = new UserDao();
//			JSONObject postJson = JsonUtil.getPostData();
//			loginUser = postJson.getString("login_user");
//			partner = postJson.getString("partner");
//			flag = postJson.getString("flag");
//			if("YES".equals(flag)){
//				int tep = userDao.chooseUserY(partner,loginUser);
//				if(tep == ResultType.LOGIN_SUCEESS){
//					User user = userDao.queryUserByLoginUser(loginUser);
//					//根据user表的查询更新comment表
//					Comments comment = new Comments();
//					comment.setId_docom(user.getId());//接口表写的是传user，但是user是string，所以传了id
//					comment.setId_getcom(user.getPartner());
//					comment.setTime_go(user.getP_time());
//					comment.setStar_com(user.getP_com());
//					CommentDao cmdo = new CommentDao();
//					cmdo.insCommentData(comment);
//				}
//			}else if("NO".equals(flag)){
//				userDao.chooseUserN(loginUser);
//			}
//			
//			return "done";
//		} catch (Exception e) {
//			e.printStackTrace();
//			result = ResultType.SERVER_EXCEPTION+"";
//			return "done";
//		}
//	}
//
//	public String getResult() {
//		return result;
//	}
//
//	public void setResult(String result) {
//		this.result = result;
//	}

}